#pragma once

#include <string.h>
#include <vector>

typedef std::string String;

namespace ShaderType
{
    enum
    {
        VertexShader = 0,
        PixelShader,
        GeometryShader,
        ComputeShader,
        HullShader,
        ShaderCount
    };
}

namespace FXParser
{
    template<class TDesc>
    unsigned int FindByName(const std::vector<TDesc>& array, const String& strName)
    {
        std::vector<TDesc>::const_iterator iter =  array.begin(),
                                                    iterEnd = array.end();

        for (unsigned int ui=0; iter != iterEnd; ++iter, ++ui)
        {
            if (iter->Name.compare(strName) == 0)
            {
                return ui;
            }
        }
        return (unsigned int)-1;

    }

    struct AnnotationDesc
    {
        String Name; 
        String Type; 
        String Value;
    };

    struct ShaderDesc
    {
        String EntryPoint;
        String Profile;
    };

    struct PassDesc
    {
        String Name; 
        std::vector<AnnotationDesc> Annotations;
        ShaderDesc Shaders[ShaderType::ShaderCount];
    };

    struct UniformDesc
    {
        String Name; 
        String Type; 
        String Value;
        String Semantic; 
        std::vector<AnnotationDesc> Annotations;
    };

    struct TechniqueDesc
    {
        String Name;
        std::vector<PassDesc> Passes;
        std::vector<AnnotationDesc> Annotations;
    };

    struct FXDesc
    {
        //std::vector<UniformDesc> Uniforms;
        std::vector<TechniqueDesc> Techniques;
    };
}
